<include file="Public:pagerForm" />
<!-- 主页面开始 -->
<SCRIPT LANGUAGE="JavaScript">
	<!--
	function listColumn(id){
		window.location = '__URL__/index/column_id/'+id;
	}
	function selectColumn(){
		var result= PopModalWindow('__APP__/Column/treeSelect/',268,365);
		if(typeof(result) == "undefined") return;
		$('columnName').value=result[0][0];
		$('column_id').value=result[0][1];
	}
    

  var select;
  var del;
  //初始化输出表格
  (function(){
  	  
  var html='';
  for(var i=1;i<=5;i++)
  {
    html+='<tr class="goods" id="stockin_goods_'+i+'"><td><span class="order"></span></td><td><input id="stockin_brand_'+i+'" class="textInput" type="text" name="items[][brand]"/></td><td><input id="stockin_product_name_'+i+'" class="textInput" type="text" name="items[][product_name]"/></td><td><input id="stockin_unit_'+i+'" class="textInput" type="text" name="items[][unit]"/></td><td><input class="textInput" type="text" name="items[][product_code]" onblur="sendAjax(this.value,'+i+',responseStorage)"/></td><td><input id="stockin_checkbox_'+i+'" class="textInputch" type="checkbox" name="items[][addname]" value="'+i+'"/></td><td><input id="stockin_goodsnumber_'+i+'" class="textInput" type="text" name="items[][number]"/></td><td><input class="textInput" type="text" name="items[][supplier]"/></td><td><input id="stockin_remove_'+i+'" class="remove" val="'+i+'" type="button"  value="移除条目"  /></td></tr>';	  
	}
	$('.goods:last').after(html);
	 for(var i=1;i<=5;i++)
     {
	     $("#stockin_checkbox_"+i).bind('click', function() {
  return select(this);
      });
	      $("#stockin_remove_"+i).bind('click', function() {
  return del(this);
  });
  
	  }
	refreshorder();
	window["num"]=i;
		
    var goodsNum=0;
    select=function(o)
	{
	if(o.checked && parseInt($.trim($("#stockin_goodsnumber_"+o.value).val()))>0)
	goodsNum+=parseInt($.trim($("#stockin_goodsnumber_"+o.value).val()));
	else if(!this.checked && parseInt($.trim($("#stockin_goodsnumber_"+o.value).val()))>0)
	goodsNum-=parseInt($.trim($("#stockin_goodsnumber_"+o.value).val()));
	else
	{
	alert('请正确填写,必须数字且大于0');
	o.checked=false;
	return;
	}
	$("#stockin_showNum").html(goodsNum);
	}
	
	del=function(p)
	{
	p_id=p.getAttribute('val');
	val=$.trim($("#stockin_goodsnumber_"+p_id).val());
	//alert($("#checkbox_"+$(this).attr("val")).attr("checked"));
	if(parseInt(val)>0 && val !='' && $("#stockin_checkbox_"+p_id).attr("checked"))
	{
	goodsNum-=parseInt(val);
	$("#stockin_showNum").html(goodsNum);
	}
	$("#stockin_goods_"+p_id).remove();
	refreshorder();
	}

   })();
   
	//-->
</SCRIPT>
 <form name="ruku" enctype="application/x-www-form-urlencoded" method="post"  action="__URL__/act_stockin" class="pageForm required-validate" onsubmit="return validateCallback(this);">
<!-- 主体内容  -->
<div class="pageHeader">
	
		<table width="100%" border="0"><input type="hidden" name="id" value="{$vo.id}" /><input type="hidden" name="spec" value="stockin" />
			<tr>
			  <td>本次入库标题标题</td><td><input name="title"  type="text" value="{$vo.title}"/></td>
			  <td>入库类型</td><td><select name="type" id="type">
				<option value="0">客用产品</option>
				<option value="1">其他用品</option>
				<option value="2">耗材</option>
				<option value="3">固定资产</option>
			  </select></td>
			  <td>选择仓库</td>
			  <td><select name="store" id="store">
				<option value="0">总库</option>
				<option value="1">南翔店</option>
				<option value="2">浦东店</option>
			  </select></td>
			  </tr>
		</table>
	
</div>
<div class="pageContent">
	<!-- 列表显示区域  -->
	<div class="list" >


		<table width="100%" border="0" style="margin:15px 0">  
		  <tr>
			<td colspan="3">入库项目明细</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		  </tr>
		  <tr>
			<td>序号</td>
			<td>系列</td>
			<td>品名</td>
			<td>规格</td>
			<td>编号</td>
			<td>将物品名称添加至库存</td>
			<td>入库数量</td>
			<td>供应商</td>
			<td><input type="button"  id="stockin_additem" value="增加条目"  onclick="addstockitem()" /></td>
		  </tr>
		  <tr class="goods" style="display:none;"></tr>
		  
			<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>合计 <font  id="stockin_showNum" color="red">0</font>件</td>
			<td><span id="sum"></span></td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			</tr>
		</table>

		<table width="100%" border="0">
		  <tr>
			<td>备注说明</td>
		  </tr>
		  <tr>
			<td><textarea name="note"></textarea></td>
		  </tr>
		  <tr>
			<td>入库人姓名{$Think.session.loginUserName}入库时间<input class="date textInput readonly" format="yyyy-MM-dd HH:mm:ss" name="date" type="text"  value="{:date('Y-m-d H:m:s')}"/>入库单号{$number}<input type="hidden" name="number" value="{$number}" /></td>
		  </tr>
		  <tr>
			<td align="right"><input name="重置" type="reset" value="重置" /><input type="submit" value="提交" /><input type="button"  value="打印"/></td>
		   </tr>
		</table>

	
	</div>
	<!--  分页显示区域 -->
	<div class="panelBar"></div>
	<!-- 列表显示区域结束 -->
</div>

</form>
<!-- 主体内容结束 -->

<!-- 主页面结束 -->